package com.rowger.player.ui.activity


import android.os.Build
import android.support.annotation.RequiresApi
import android.support.v7.widget.Toolbar

import com.rowger.player.R
import com.rowger.player.base.BaseActivity
import com.rowger.player.util.FragmentUtil
import com.rowger.player.util.ToolBarManager
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.activity_main.view.*
import org.jetbrains.anko.find



class MainActivity : BaseActivity(),ToolBarManager {
    //惰性加载
    override val toolbar by lazy { find<Toolbar>(R.id.toolbar) }


    override fun getLayoutId(): Int {
       return R.layout.activity_main
    }
//
    @RequiresApi(Build.VERSION_CODES.LOLLIPOP)
    override fun initData() {
        initMainToolBar()
    }

    override fun initLisenter() {
        //

        bottomBar.setOnTabSelectListener {
            println("it--------------------------$it")
            //it
            val transaction =supportFragmentManager.beginTransaction()
            transaction.replace(R.id.container,FragmentUtil.fragmentUtil.getFragment(it),it.toString())
            transaction.commit()
        }
    }
}


